<?php

/**
 * persona form base class.
 *
 * @method persona getObject() Returns the current form's model object
 *
 * @package    sistema_itec_new
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasepersonaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                      => new sfWidgetFormInputHidden(),
      'legajo'                  => new sfWidgetFormInputText(),
      'apellido'                => new sfWidgetFormInputText(),
      'nombre'                  => new sfWidgetFormInputText(),
      'foto'                    => new sfWidgetFormInputText(),
      'calle'                   => new sfWidgetFormInputText(),
      'numero'                  => new sfWidgetFormInputText(),
      'torre'                   => new sfWidgetFormInputText(),
      'piso'                    => new sfWidgetFormInputText(),
      'departamento'            => new sfWidgetFormInputText(),
      'fecha_nacimiento'        => new sfWidgetFormDate(),
      'documento'               => new sfWidgetFormInputText(),
      'email'                   => new sfWidgetFormInputText(),
      'telefono_fijo'           => new sfWidgetFormInputText(),
      'celular'                 => new sfWidgetFormInputText(),
      'sexo'                    => new sfWidgetFormInputText(),
      'tipo_sangre'             => new sfWidgetFormInputText(),
      'barrio_id'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Barrio'), 'add_empty' => false)),
      'localidad_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Localidad'), 'add_empty' => false)),
      'nacionalidad_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Nacionalidad'), 'add_empty' => false)),
      'tipo_documento_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TipoDocumento'), 'add_empty' => false)),
      'localidad_nacimiento_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Localidad_2'), 'add_empty' => false)),
      'estado_civil_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('EstadoCivil'), 'add_empty' => false)),
      'compania_celular_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CompaniaCelular'), 'add_empty' => true)),
      'usuario_id'              => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'                      => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'legajo'                  => new sfValidatorInteger(array('required' => false)),
      'apellido'                => new sfValidatorString(array('max_length' => 100)),
      'nombre'                  => new sfValidatorString(array('max_length' => 100)),
      'foto'                    => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'calle'                   => new sfValidatorString(array('max_length' => 100)),
      'numero'                  => new sfValidatorString(array('max_length' => 5)),
      'torre'                   => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'piso'                    => new sfValidatorString(array('max_length' => 2, 'required' => false)),
      'departamento'            => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'fecha_nacimiento'        => new sfValidatorDate(),
      'documento'               => new sfValidatorString(array('max_length' => 15)),
      'email'                   => new sfValidatorString(array('max_length' => 100)),
      'telefono_fijo'           => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'celular'                 => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'sexo'                    => new sfValidatorString(array('max_length' => 1)),
      'tipo_sangre'             => new sfValidatorString(array('max_length' => 3)),
      'barrio_id'               => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Barrio'))),
      'localidad_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Localidad'))),
      'nacionalidad_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Nacionalidad'))),
      'tipo_documento_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('TipoDocumento'))),
      'localidad_nacimiento_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Localidad_2'))),
      'estado_civil_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('EstadoCivil'))),
      'compania_celular_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('CompaniaCelular'), 'required' => false)),
      'usuario_id'              => new sfValidatorInteger(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('persona[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'persona';
  }

}
